package com.turing.post.thirdinterface.impl;

import java.math.BigInteger;

import javax.ejb.Local;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import com.turing.post.thirdinterface.util.MapSaleBranchDao;

@Stateless(mappedName = "thirdinterface.impl.MapSaleBranchDaoImpl")
@Remote
@Local
public class MapSaleBranchDaoImpl implements MapSaleBranchDao {

	/**
	 * 实体管理器
	 */
	@PersistenceContext
	protected EntityManager _em;

	@Override
	public String getSaleBrchNoFromMapSaleBranch(BigInteger customId) {
		String sql = "select t.salebranchno from mapsalebranch t where t.customid=?1";
		Query query = _em.createNativeQuery(sql);
		query.setParameter(1, customId);
		return (String) query.getSingleResult();
	}

}
